#!/bin/sh
#
# board specific defaults
#------------------------------------------------------------------------------

# FIXME TELEM

# Mavlink ethernet (CFG 1000)
param set-default MAV_1_CONFIG 1000
param set-default MAV_1_BROADCAST 1
param set-default MAV_1_MODE 0
param set-default MAV_1_RADIO_CTL 0
param set-default MAV_1_RATE 100000
param set-default MAV_1_REMOTE_PRT 14550
param set-default MAV_1_UDP_PRT 14550

param set-default SENS_EXT_I2C_PRB 0
param set-default CYPHAL_ENABLE 0

if ver hwtypecmp MR-CANHUBK3-ADAP
then
	param set-default GPS_1_CONFIG 202
	param set-default RC_PORT_CONFIG 104
	param set-default SENS_INT_BARO_EN 0
	param set-default SYS_HAS_BARO 0
	# MR-CANHUBK3-ADAP voltage divider
	param set-default BAT1_V_DIV 13.158
	safety_button start
fi

if [ -f "/mnt/qspi/mtd_net" ]
then
else
	netman update -i eth0
fi

if param greater -s UAVCAN_ENABLE 0
then
	ifup can0
	ifup can1
	ifup can2
	ifup can3
fi
if param greater -s CYPHAL_ENABLE 0
then
	ifup can0
	ifup can1
	ifup can2
	ifup can3
fi
